<?php

namespace app\store\controller;

use think\facade\Filesystem;

class UploadController extends BaseController
{
    public function index()
    {
        $file = $this->request->file('image');
        $savename = Filesystem::disk('public')->putFile('admin', $file);

        return json(['code' => 1, 'src' => '/storage/' .$savename]);
    }

    public function layedit()
    {
        $file = $this->request->file('file');
        $savename = Filesystem::disk('public')->putFile('admin', $file);

        return json(['code' => 0,'location' =>$this->request->domain() . '/storage/' .$savename]);
    }

    public function uploadApk()
    {
        $file = $this->request->file('file');
        $savename = Filesystem::disk('public')->putFileAs('apk', $file, 'by.apk');

        return json(['code' => 1,'location' =>$this->request->domain() . '/storage/' .$savename]);
    }

    public function uploadWgt()
    {
        $file = $this->request->file('file');
        $savename = Filesystem::disk('public')->putFile('apk', $file);

        return json(['code' => 1,'location' =>$this->request->domain() . '/storage/' .$savename]);
    }
}